package DynamicProgramming;

public class _357_CountNumberswithUniqueDigits {
    public int countNumbersWithUniqueDigits(int n) {
        if(n==0) return 1;
        if(n==1) return 10;
        int res = 10;
        int numberOptional = 9;
        int totalSize = 9;
        while (n > 1 && numberOptional > 0) {
            totalSize = totalSize * numberOptional;
            res += totalSize;
            n--;
            numberOptional--;
        }
        return res;
    }
}
